package com.zl.tby.vo;

import com.zl.tby.model.TbyEducationRoom;
import lombok.Data;
import org.noear.solon.validation.annotation.Length;
import org.noear.solon.validation.annotation.NotBlank;
import org.noear.solon.validation.annotation.NotNull;

import java.math.BigDecimal;

/**
 * 科研宣教-宣教馆
 * @author changpeng
 * @version 1.0
 * @since 2024/8/6 20:12
 */
@Data
public class TbyEducationRoomForm {
    /**主键id*/
    private Long id;
    /**名称*/
    @NotBlank(message = "名称不能为空")
    @Length(max = 20, message = "名称最大长度为20")
    private String name;
    /**面积*/
    @NotNull(message = "面积不能为空")
    private BigDecimal area;
    /**经度*/
    @NotBlank(message = "经度不能为空")
    @Length(max = 32, message = "经度最大长度为32")
    private String longitude;
    /**纬度*/
    @NotBlank(message = "纬度不能为空")
    @Length(max = 32, message = "纬度最大长度为32")
    private String latitude;
    /**描述*/
    @Length(max = 2000, message = "纬度最大长度为2000")
    private String content;

    public TbyEducationRoom createEntity() {
        TbyEducationRoom entity = new TbyEducationRoom();
        entity.setName(this.getName());
        entity.setArea(this.getArea());
        entity.setImageCount(0);
        entity.setVideoCount(0);
        entity.setLongitude(this.getLongitude());
        entity.setLatitude(this.getLatitude());
        entity.setContent(this.getContent());
        return entity;
    }

    public void updateEntity(TbyEducationRoom entity) {
        entity.setName(this.getName());
        entity.setArea(this.getArea());
        entity.setLongitude(this.getLongitude());
        entity.setLatitude(this.getLatitude());
        entity.setContent(this.getContent());
    }
}
